<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon.png" />
<link rel="apple-touch-startup-image" href="images/apple-touch-startup-image.png" />
<title></title>

<!-- Main CSS file -->
<link rel="stylesheet" href="style.css"  type="text/css" media="screen" />
<style type="text/css"> 
/*
.line{
height:1px; 
background-color:#000; 
position:absolute; 
top:50%; 
left:0px; 
width:100%;
}
.photo{
position:absolute; 
top:50%; 
left:50%;
width:100px;
height:100px; 
margin:-50px 0 0 -50px; 
border:3px solid #f60;
-webkit-border-radius:50%; 
-moz-border-radius:50%; 
-o-border-radius:50%; 
border-radius:50%;
}
.photo img{
    width:100px; 
    height:100px;
    margin:0 auto; 
    -webkit-border-radius:50%; 
    -moz-border-radius:50%; 
    -o-border-radius:50%; 
    border-radius:50%; 
}*/
.box{ 
    border:3px solid #FFFFFF; 
    width:100px; 
    height:100px;
    margin:0 auto; 
    -webkit-border-radius:50%; 
    -moz-border-radius:50%; 
    -o-border-radius:50%; 
    border-radius:50%;
} 
.box img{ 
    width:100px; 
    height:100px;
    margin:0 auto; 
    -webkit-border-radius:50%; 
    -moz-border-radius:50%; 
    -o-border-radius:50%; 
    border-radius:50%; 
} 
.top_text{
    /*width: 100%;
    height: 20px;
    line-height: 20px;*/
    /*text-align: center;*/
    margin: 0 auto;
    margin-bottom:15%; 
    padding-top:15%; 
    text-align: left;
    font-size: 24px;
    font-weight: bold;
    color: #FFFFFF;
}
.bottom_text{
   /* position:absolute; 
    bottom: 0px; 
    left:0px; */

    width: 100%;
    height: 20px;
    line-height: 20px;
    text-align: center;
    margin: 0 auto;
    margin-top:15%;
    margin-bottom:15%;
    font-size: 24px;
    font-weight: bold;
    color: #FFFFFF;
}
.submit_bottom{
    /*position:absolute; 
    bottom: 0px; 
    left:0px; */
    
    height:30px; 
    line-height:30px;
    text-align:center;
}

.mt{margin-top: 20px;}

.button{

  display: inline-block;

  *display: inline;

  zoom: 1;

  padding: 6px 20px;

  margin: 0;

  cursor: pointer;

  border: 1px solid #bbb;

  overflow: visible;

  font: bold 13px arial, helvetica, sans-serif;

  text-decoration: none;

  white-space: nowrap;

  color: #555;

  background-color: #ddd;

  background-image: linear-gradient(top, rgba(255,255,255,1),

                                         rgba(255,255,255,0));

  -webkit-transition: background-color .2s ease-out;

  -moz-transition: background-color .2s ease-out;

  background-clip: padding-box; /* Fix bleeding */

  border-radius: 3px;

  box-shadow: 0 1px 0 rgba(0, 0, 0, .3),

              0 2px 2px -1px rgba(0, 0, 0, .5),

              0 1px 0 rgba(255, 255, 255, .3) inset;

  text-shadow: 0 1px 0 rgba(255,255,255, .9);  

}

.button:hover{

  background-color: #eee;

  color: #333;

}

.button:active{

  background: #e9e9e9;

  position: relative;

  top: 1px;

  text-shadow: none;

  box-shadow: 0 1px 1px rgba(0, 0, 0, .3) inset;

}

.button.small{

  padding: 4px 12px;

}

/* Larger buttons styles */

.button.large{

  padding: 12px 30px;

  text-transform: uppercase;

}

.button.large:active{

  top: 2px;

}

.button.green,.button.red,.button.blue{

        color: #FFF;

        text-shadow: 0 1px 0 rgba(0,0,0,.5);

    background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));

        background-image: -moz-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));

        background-image: -o-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));

        background-image: -ms-linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));

        background-image: linear-gradient(top, rgba(255,255,255,.3), rgba(255,255,255,0));

}

/*********green button***********/

.button.green{

  background-color: #57a957;

  border-color: #57a957;

}

.button.green:hover{

  background-color: #62c462;

}

.button.green:active{

  background: #57a957;

}

/************red button***********/

.button.red{

  background-color: #c43c35;

  border-color: #c43c35;

}

.button.red:hover{

  background-color: #ee5f5b;

}

.button.red:active{

  background: #c43c35;

}

/*************blue button***************/

.button.blue{

  background-color: #269CE9;

  border-color: #269CE9;

}

.button.blue:hover{

  background-color: #70B9E8;

}

.button.blue:active{

  background: #269CE9;

}

/*******disabled button*********/

.button[disabled], .button[disabled]:hover, .button[disabled]:active{

  border-color: #eaeaea;

  background: #fafafa;

  cursor: default;

  position: static;

  color: #999;

  /* Usually, !important should be avoided but here it's really needed :) */

  box-shadow: none !important;

  text-shadow: none !important;

}

.green[disabled], .green[disabled]:hover, .green[disabled]:active{

  border-color: #57A957;

  background: #57A957;

  color: #D2FFD2;

}

.red[disabled], .red[disabled]:hover, .red[disabled]:active{

  border-color: #C43C35;

  background: #C43C35;

  color: #FFD3D3;

}

.blue[disabled], .blue[disabled]:hover, .blue[disabled]:active{

  border-color: #269CE9;

  background: #269CE9;

  color: #93D5FF;

}

/*********group button**********/

.button-group,.button-group li{

  display: inline-block;

  *display: inline;

  zoom: 1;

}

.button-group{

  font-size: 0; /* Inline block elements gap - fix */

  margin: 0;

  padding: 0;

  background:#f1f1f1;

  border-bottom: 1px solid rgba(0, 0, 0, .07);

  padding: 7px;

  border-radius: 7px; 
}

.button-group li{

  margin-right: -1px; /* Overlap each right button border */

}

.button-group .button{

  font-size: 13px; /* Set the font size, different from inherited 0 */

  border-radius: 0; 
}

.button-group .button:active{

  box-shadow: 0 0 1px rgba(0, 0, 0, .2) inset,

              5px 0 5px -3px rgba(0, 0, 0, .2) inset,

              -5px 0 5px -3px rgba(0, 0, 0, .2) inset;   

}

.button-group li:first-child .button{

  border-radius: 3px 0 0 3px;

}

.button-group li:first-child .button:active{

  box-shadow: 0 0 1px rgba(0, 0, 0, .2) inset,

              -5px 0 5px -3px rgba(0, 0, 0, .2) inset;

}

.button-group li:last-child .button{

  border-radius: 0 3px 3px 0;

}

.button-group li:last-child .button:active{

  box-shadow: 0 0 1px rgba(0, 0, 0, .2) inset,

              5px 0 5px -3px rgba(0, 0, 0, .2) inset;

}

body {
	background-image: url(vcardbg11.jpg);
	background-size:cover;
	height:100%;
	width:100%; 
	/*background-repeat: no-repeat;*/
}
</style>
</head>
<?php
/*
$dbname = SAE_MYSQL_DB;//数据库的名称
$host =SAE_MYSQL_HOST_M;
$port =SAE_MYSQL_PORT;
$user =SAE_MYSQL_USER;
$pwd = SAE_MYSQL_PASS;
$link = @mysql_connect("{$host}:{$port}",$user,$pwd,true);
if(!$link) {
	   die("Connect Server Failed: " . mysql_error($link));
	  }
if(!mysql_select_db($dbname,$link)) {
	   die("Select Database Failed: " . mysql_error($link));
	  }
mysql_query("SET NAMES UTF8");
*/
include dirname(__FILE__).'/config.php';
$appid=APPID;
$secret=SECRET;
$code = $_GET['code'];
$shenfen= $_GET['id'];
$acc_url='https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$appid.'&secret='.$secret.'&code='.$code.'&grant_type=authorization_code';
$acc_json=file_get_contents($acc_url);
$acc_array=json_decode($acc_json,true); 
//print_r($acc_array);
$openid=$acc_array['openid'];
$acc_token=$acc_array['access_token'];
$user_url='https://api.weixin.qq.com/sns/userinfo?access_token='.$acc_token.'&openid='.$openid;
$user_json=file_get_contents($user_url);
$user_array=json_decode($user_json,true);
//print_r($user_array);
$sex= $user_array['sex'];
$img=$user_array['headimgurl'];
$nick_name=bin2hex($user_array['nickname']);
//$sql = "UPDATE  `weixin_flag` SET  `nickname` =  '$nick_name',`flag` = 2,`avatar` = '$img',`sex` = '$sex' WHERE `openid` = '$openid'";
$sql = "UPDATE  `weixin_flag` SET  `nickname` =  '$nick_name',`flag` = 2,`avatar` = '$img',`sex` = '$sex' WHERE `openid` = '$shenfen'";
mysql_query($sql);
//echo 'done!';
//echo $code;
if(!empty($img))
{
?>
<body class="home">    
<div id="container">
    <div id="main_panels">
        <div class="panels_slider" >
            <div class="top_text">
               亲爱的：<?php echo $user_array['nickname']?>
            </div>
            <!--<div class="line"></div>
            <div class="photo">
                <img src="images/123.jpg">
            </div>-->
            <div no-repeat center;">
                <!--<div style="width:100%;height:1px;background:#ff0000;position:absolute;top:0px;left:0px;top:330px;z-index:-1;">
                </div>-->
                <div class="box"> 
                    <img src="<?php echo $img?>">
                </div>
            </div>
            <div class="bottom_text">
                恭喜您签到成功!
            </div>
			 <div class="bottom_text">
                关闭此页回复任意消息即可参与！
            </div>
			
            <div class="submit_bottom">
              <button class="button blue" style="width:60%;" onclick="WeixinJSBridge.call('closeWindow');">关闭本页面</button>
            </div>
        </div>
    </div>
</div>
</body>


<?php
}
?>
</html>

